#include <stdio.h>
#include <memory.h>

int s[ 1000001 ], d[ 1000001 ];
bool v[ 1000001 ];

int find( int root )
{
    if ( s[ root ] < 0 )
        return root;
    return s[ root ] = find( s[ root ] );
}

void unionset( int root1, int root2 )
{
    s[ root1 ] = root2;
}

int main( )
{
    int i, j, a, b, f1, f2, t;
    bool er;
    while ( scanf("%d%d", &a, &b) != EOF )
    {
        if ( a == -1 && b == -1 ) break;
        if ( a == 0 && b == 0 )
            printf("Yes\n");
        else
        {
            memset( v, 1, sizeof( v ) );
            memset( s, -1, sizeof( s ) );
            er = true;
            f1 = find( a );
            f2 = find( b );
            if ( f1 != f2 )
                unionset( f1, f2 );
            else
                er = false;
            d[ 0 ] = a;
            d[ 1 ] = b;
            v[ a ] = v[ b ] = false;
            t = 2;
            while ( scanf("%d%d", &a, &b) != EOF )
            {
                if ( a == 0 && b == 0 ) break;
                f1 = find( a );
                f2 = find( b );
                if ( f1 != f2 )
                    unionset( f1, f2 );
                else
                    er = false;
                if ( v[ a ] )
                    d[ t++ ] = a;
                if ( v[ b ] )
                    d[ t++ ] = b;
                v[ a ] = v[ b ] = false;
            }
            f2 = find( d[ 0 ] );
            for ( i = 1; i < t; i++ )
            {
                f1 = find( d[ i ] );
                if ( f1 != f2 )
                {
                    er = false;
                    break;
                }
                f2 = f1;
            }
            if ( er )
                printf("Yes\n");
            else
                printf("No\n");
        }
    }
    return 0;
}
